﻿<!-- 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{$s_info.name}</title>
<meta http-equiv="X-UA-Compatible" content="IE=8"> 
<meta name="keywords" content='bbs'>
<meta name="description" content='bbs'>
<link rel="stylesheet" href="__STATIC__/css/pc_reset.css">
<link rel="stylesheet" href="__STATIC__/css/qb_ui.css">
<link rel="stylesheet" href="__STATIC__/icon/icon.css">
<script type="text/javascript" src="__STATIC__/js/core/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
</head>
<body>
<link rel="stylesheet" href="__STATIC__/bbs/head.css">
<div class="HeadContainer">
	<ul class="TopBox">
		<li class="logo"><a href="#"><img src="__STATIC__/bbs/logo.png"></a></li>
		<li class="menu">
			<a href="#" class="ck">论坛首页</a>
			<a href="#">门户系统</a>
			<a href="#">技术联盟</a>
			<a href="#">网站首页</a>
		</li>
		<li class="search">
			<form action="#" method="post">
				<dl>
					<dt><input type="text" name="keyword" placeholder="输入关键字" required/><button type="submit"><i class="fa fa-search"></i></button></dt>
					<dd><a href="#">登录</a> <a href="#">注册</a></dd>					
				</dl>
			</form>
		</li>
	</ul>
</div>

 -->
{extend name="$index_style_layout" /}

<!--SEO相关-->
{block name="head_title"}{$info.title}{/block}
{block name="head_keword"}{$info.title} {:get_sort($info.fid)}  {:M('name')}{/block}
{block name="head_description"}{:get_word(del_html($info['content']),300)}{/block}

{block name="body_content"}
<link rel="stylesheet" href="__STATIC__/bbs/list.css">
<div class="MainContainer">
	<div class="Container">
		<div class="LeftCnt">
			<div class="ShowContent">
				<div class="topinfo">
					<div class="guide"><a href="{:urls('index/index')}">社区主页</a> -&gt; <a href="{:urls('content/index',['fid'=>$fid])}">{$s_info.name}</a></div>
					<dl class="SharBox">
						<dt><span onClick="$('.SharBox dd').fadeIn();">分享到：<i class="fa fa-share-square-o"></i></span></dt>
						<dd>
							<div class="bshare-custom">
								<a title="分享到微信" class="bshare-weixin"></a>
								<a title="分享到新浪微博" class="bshare-sinaminiblog"></a>
								<a title="分享到Facebook" class="bshare-facebook"></a>
								<a title="分享到QQ空间" class="bshare-qzone"></a>
								<a title="分享到Twitter" class="bshare-twitter"></a>
								<a title="分享到Google+" class="bshare-gplus"></a>
								<a title="分享到QQ好友" class="bshare-qqim"></a>
							</div>
							<div class="exit" onClick="$('.SharBox dd').fadeOut();">X</div>
						</dd>				
					</dl>
					<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/buttonLite.js#style=-1&amp;uuid=&amp;pophcol=2&amp;lang=zh"></script>
					<script type="text/javascript" charset="utf-8" src="http://static.bshare.cn/b/bshareC0.js"></script>
				</div>
				<div class="title">{$info.title}</div>
				<div class="thebase">
					<ul>
						<ol><a href="{:get_url('user',$info['uid'])}" target="_blank"><img src="{$info.uid|get_user_icon}" onerror="this.src='__STATIC__/images/nobody.gif'"  onmouseover="changeShowImg($(this),'over');" onmouseout="changeShowImg($(this),'out');" ></a></ol>
						<li>
							<div><span>{$info.uid|get_user_name}</span><em>{$info.create_time|date='Y-m-d H:i',###}</em></div>
							<div><a href="#">{:getGroupByid(get_user($info['uid'])['groupid']?:'')}</a></div>
						</li>
					</ul>
					<dl>
						<dt><i class="si si-eye"></i>{$info.view}</dt>
						<dd><i class="fa fa-commenting-o"></i>{$info.replynum} {if ($admin || $info['uid']==$userdb['uid'])}<i onclick="delinfo({$info.id},0)" class="fa fa-trash-o"></i> <i onclick="editinfo({$info.id},0)" class="fa fa-edit"></i>{/if}</dd>
					</dl>
				</div>
				<div class="content_html">
					{$info.content}
{volist name="$info.picurls" id="rs"}
</br><img src="{$rs.picurl}"/>
{/volist}
				</div>
				<div class="content_act">
					<div  onclick="TopicAgree()"><span><i class="fa fa-thumbs-o-up"></i></span><em id="topic_agree">{$info.agree}</em></div>
					<div><a onclick="replyuser(0)" href="#PostComment"><span><i class="fa fa-edit"></i></span><em>点击回复</em></a></div>
				</div>				
			</div>
			<div class="ShowComment">
				<ul class="head"><ol>全部留言</ol><li>共 <span id="commentnum">{$info.replynum}</span> 条</li></ul>
{qb:reply name="pcbbs_reply" rows="15"}
				<div class="ListComment">
				{volist name="listdb" id="rs"}
					<div class="lists">
						<ul>
							<ol><a href="{:get_url('user',$rs['uid'])}" target="_blank"><img src="{$rs.icon}" onerror="this.src='__STATIC__/images/nobody.gif'"  onmouseover="changeShowImg($(this),'over');" onmouseout="changeShowImg($(this),'out');" ></a></ol>
							<li>
								<div class="info"><a href="{:get_url('user',$rs['uid'])}" target="_blank">{$rs.username} </a><span>{:getGroupByid(get_user($rs['uid'])['groupid']?:'')} </span><em> {$rs.time}</em><i>{$i}楼</i></div>
								<div class="cnt replycontent" style="word-break:break-all;">{$rs.content}</div>
								<div class="replaycomment repalyinfs{$rs.id}">
									{volist name="rs.children" id="vs"}
									<dl>
										<dt><a href="{:get_url('user',$vs['uid'])}">{$vs.username} </a><em> {$vs.time}</em></dt>
										<dd style="word-break:break-all;" class="replycontent">{$vs.content}  {if ($this->admin || $vs['uid']==$this->user['uid'])}<i onclick="delinfo({$aid},{$vs.id})" class="fa fa-trash-o"></i>{/if} </dd>
									</dl>
									 {/volist}
								</div>
							</li>
						</ul>
						<div class="other">
							<i class="fa fa-thumbs-o-up"  onclick="reply_agree({$rs.id})"></i><span  onclick="reply_agree({$rs.id})" class="upnum replyAgree{$rs.id}">{$rs.agree}</span>
							<a onclick="replyuser({$rs.id})" href="javascript::"><i class="fa fa-commenting-o"></i><span>回复</span></a>
							{if ($this->admin || $rs['uid']==$this->user['uid'])}<i onclick="delinfo({$aid},{$rs.id})" class="fa fa-trash-o"></i>{/if}
						</div>
					</div>
				{/volist}
				</div>
				<div class="ShowMoreComment"><span onclick="ShowMoreComment()">更多留言<i class="fa fa-angle-double-down"></i></span></div>
		<script type="text/javascript">
		var posturl="{:reply_api('posturl',$aid,$cfg_array)}";
		var pageurl="{:reply_api('pageurl',$aid,$cfg_array)}";
		</script>
{/qb:reply}

<script type="text/javascript">
jQuery(document).ready(function() {
	$(".content_html img").each(function(){
		$(this).click(function(){
			window.open($(this).attr('src'));
		});
	});
	$(".ShowComment .replycontent img").each(function(){
		$(this).click(function(){
			window.open($(this).attr('src'));
		});
		$(this).css({"max-width":'700px',});
	});
})
</script>

<script type="text/javascript">
var ueditor;

//修改信息
function editinfo(aid,id){
	var url;
	if(id>0){
		url="{:urls('reply/edit')}?id="+id;
	}else{
		url="{:urls('content/edit')}?id="+aid;
	}
	location.href = url;
}

//删除信息
function delinfo(aid,id){
	var url;
	if(id>0){
		url="{:urls('wxapp.reply/delete')}?id="+id;
	}else{
		url="{:urls('wxapp.post/delete')}?id="+aid;
	}
	$.get(url,function(res){
		if(res.code==0){
			layer.alert("删除成功！");			
			if(id==0){
				location.href="{:urls('index/index')}";
			}else{
				location.reload();
			}
		}else{
			layer.msg("删除失败:"+res.msg,{time:1500});
		}	
	});
}

//主题点赞
function TopicAgree(){	
	$.get("{:urls('wxapp.post/agree',['id'=>$id])}?"+Math.random(),function(res){
		if(res.code==0){
			var num =  $('#topic_agree').html();
			num++;
			$('#topic_agree').html(num);
			layer.msg("点赞成功！",{time:1500});
		}else{
			layer.msg("点赞失败:"+res.msg,{time:1500});
		}	
	});
}

//回复点赞
function reply_agree(id){
	$.get("{:urls('wxapp.reply/agree')}?id=" + id + "&" + Math.random(),function(res){
		if(res.code==0){
			var num =  $('.replyAgree'+id).html();
			num++;
			$('.replyAgree'+id).html(num);
			layer.msg("点赞成功！",{time:1500});

		}else{
			layer.msg("点赞失败:"+res.msg,{time:1500});
		}	
	});
}

//显示分页
var page=1;
var check_showMore=1;
var pid = 0;
function ShowMoreComment(){
	page++;
	check_showMore=0;
	$('.ShowMoreComment').fadeIn();
	$.get(pageurl + "?page="+page+"&"+Math.random(),function(res){
		$('.ShowMoreArtic').fadeOut();
		if(res.code==0){
			if(res.data==''){
				layer.msg("没有更多内容了！",{time:500});
				$('.ShowMoreComment').hide();
			}else{
				$('.ListComment').append(res.data);
				check_showMore=1;
			}
		}else{
			layer.msg(res.msg,{time:2500});
		}
	});
}

//弹出层进行评论
function pop_post(){
	var contents = $(".replayBox textarea").val();
	contents = contents.replace("\n","<br>");
	contents = contents.replace(" ","&nbsp;");	
	layer.closeAll();
	postcontent({content:contents},true);
	$(".replayBox textarea").val('')
}

//引用回复
function replyuser(id){
	pid = id;
	//ueditor.focus()
	if(check_jump_login()!=true) return ;
	layer.open({
	  type: 1,
	  title:'给TA回复',
	  area: ['600px','550px'], //宽高，高参数忽略
	  content: '<ul class="replayBox" style="text-align:center;"><ol><textarea onkeydown="keySend(event);" style="width:560px;height:400px;margin:10px;" placeholder="请输入回复内容"></textarea></ol><li><button onclick="layer.closeAll();" style="padding:10px;">取消</button>  <button style="margin-left:50px;padding:10px;" onclick="pop_post();">确定提交</button></li></ul>',
	});
}

function keySend(event) {
	if (event.ctrlKey && event.keyCode == 13) {
		pop_post();
	}
}

function check_jump_login(){
	if("{$userdb.uid}"==""){
		layer.confirm('要先登录,才能发表评论,你确认要登录吗？', {
            btn : [ '确定', '取消' ]
        }, function(index) {
            location.href="{:get_url('login')}";
        });		
	}else{
		return true;
	}
}

</script>
			</div>
			<div id="PostComment">
			<form class="ajax-post" method="post"  action="" onsubmit="return false;">
				<div class="ueditor">
<script id="content" class="js-ueditor" name="content" type="text/plain"></script>
<script type="text/javascript"> 
jQuery(document).ready(function() {
	//重新定义编辑器的宽度＝表单提交容器标签的宽度
	$('#PostComment .ueditor').width($('#PostComment .submit').width());   
    ueditor =  UE.getEditor($('.js-ueditor').attr('name'), {
            initialFrameHeight:300,  //初始化编辑器高度,默认320
            autoHeightEnabled:false,  //是否自动长高
            maximumWords: 50000, //允许的最大字符数
            serverUrl: '{:urls("index/attachment/upload","dir=images&from=ueditor&module=bbs")}',
			toolbars: [
						['fullscreen', 'source', 'undo', 'redo', 'forecolor','backcolor','bold','fontsize','insertimage','attachment','link','emotion','pasteplain']
					],
        });
 
});

//ctrl+enter 事件
function postform(){
	layer.confirm('你确认要提交吗?',{
            btn:['确定','取消']
        },function(index){
			var form_data = $('.ajax-post').serialize();
			postcontent(form_data);
        }
	);
}

//检查用户登录状态
var user_uid = "{$userdb.uid}";
function check_login(){
	if(user_uid!=''){
		return true;
	}
	layer.open({
	  type: 2,
	  title: '用户登录',
	  shadeClose: true,
	  shade: false,
	  maxmin: true, //开启最大化最小化按钮
	  area: ["750px", "780px"],
	  content: "{:get_url('login')}&type=iframe",
	  end: function(){
		  	//window.location.reload();
			$.get("{:urls('index/wxapp.login/web_login_check')}?" + Math.random(),function(res){
				layer.closeAll();
				if(res.code==0){
					user_uid = res.data.uid;
					layer.msg("登录成功,你现在可以发表信息了",{time:1500});
				}else{
					layer.msg("登录失败");
				}	
			});
		}
	});
}



var havepost = false;
function postcontent(form_data,islayer){
	if(check_login()!==true){	//检查用户登录状态
		return false;
	}
			var that  = ueditor;
			var url = posturl;
			if(pid>0){
				url += '?pid='+pid;
			}
			if(islayer!==true && that.hasContents()==false){
				layer.alert('内容不能为空')
				return false;
			}
			if(havepost==true){
				layer.msg('请不要重复提交');
				return ;
			}
			havepost = true;
            $.post(url, form_data).success(function (res) {
				havepost = false;
                if(res.code==0){
					if(pid>0){
						$('.repalyinfs'+pid).html(res.data);
					}else{
						$('.ListComment').html(res.data);
						//$('.ShowMoreComment').fadeIn();
					}
					//layer.closeAll(); //关闭所有层
					layer.msg('发表成功！');
					//that.hide();
					that.setContent('');					
					//HiddenShowMoreComment();
				}else{
					layer.alert(res.msg);
				}
            }).fail(function () {
				layer.open({title: '提示',content: '服务器发生错误'});
            });            
}

	$(document).ready(function(){
		//$('.ajax-post').attr('action', pid>0 ? posturl+'?pid='+pid : posturl );	//主要是针对编辑器的ctarl+enter发信息用
        $('.ajax-post').submit(function () {
            var form_data = $(this).serialize();
			postcontent(form_data);
			return false;
        });
    });
</script>
<script src="__STATIC__/libs/ueditor/ueditor.config.js"></script>
<script src="__STATIC__/libs/ueditor/ueditor.all.min.js"></script>
				</div>
				<div class="submit"><button type="submit">发表回复</button></div>
				</form>
			</div>
		</div>
		<div class="RightCnt">
			<div class="RightSide">
				<dl class="RightBase">
					<dt>
						<a href="{:urls('add',['fid'=>$info['fid']])}"><button type="button">发表新贴</button></a>
					</dt>
					<dd>
						<div class="h"><span>热门版块</span></div>
						<ul>
{volist name="''|sort_config" id="rs"}
							<li><a href="{:urls('content/index',['fid'=>$rs['id']])}" {eq name="$info.fid" value="$rs.id"}class="ck"{/eq}>{$rs.name}</a></li>
{/volist}
						</ul>
					</dd>
				</dl>
				<div class="SideMores">
					<div class="h"><span>精彩内容</span></div>
					<ul class="ListNewfen">
{qb:tag name="pc_indexpage" type="bbs" order="status" rows="8"}
						<li><a href="{$rs.url}">{$rs.title}</a></li>
{/qb:tag}
					</ul>
					<div class="MOreShow msnewfen"><button type="button" onclick="MoreShowNewfen('{qb:url name='pc_indexpage' /}')">更多<i class="fa fa-chevron-down"></i></button></div>
				</div>
<script type="text/javascript">
var M_s_page = 1;
function MoreShowNewfen(url){
	M_s_page++;
	$.get(url+M_s_page+'&'+Math.random(),function(res){
		if(res.code==0){
			if(res.data==''){
				layer.msg("已经显示完了！",{time:500});
				$('.msnewfen').hide();
			}else{
				$('.ListNewfen').append(res.data);
			}
		}else{
			layer.msg(res.msg,{time:2500});
		}
	});
}
</script>
				<dl class="WXcode">
					<dt>扫一扫访问手机版</dt>
					<dd><img src="{:get_qrcode(get_url('location'))}"/>
					</dd>
				</dl>
			</div>
		</div>
	</div>
</div>
<div class="topUpCont">
    <ul>
    	<ol><i class="fa fa-angle-double-up"></i></ol>
        <li>回到顶部</li>
    </ul>
</div>
<script>
$(document).ready(function () {
	//右边页面的高度
	var rightBoxH=$('.RightSide').height();
	//头部高度+35px间距
	var headBoxH=$('.HeadContainer').height()+35;
	$(window).scroll(function () {
		var scroll_Height=$(window).scrollTop();
		if(scroll_Height>rightBoxH){
			$('.RightBase').addClass('RightBase1');
			var thistopH=scroll_Height-headBoxH;
			$(".RightBase").css({'top':thistopH+'px'});
		}else{
			$('.RightBase').removeClass('RightBase1');
		}
		if (scroll_Height > 100) {
			$(".topUpCont").show();
		} else {
			$(".topUpCont").hide();
		}
	});
	$(".topUpCont").click(function () {
		$("html,body").animate({scrollTop:0},500);
	});
});	
</script>
{/block}
